<%= form_for(@transaction) do |f| %>
  <% if @transaction.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@transaction.errors.count, "error") %> prohibited this transaction from being saved:</h2>

      <ul>
      <% @transaction.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :seller %>
    <%= f.text_field :seller, :value => current_user,  :disabled => true %>
  </div>
  <div class="field">
    <%= f.label :buyers %>
    <%= f.text_area(:buyers) %>
    <p>(Séparer les pseudos des acheteurs par les virgules)</p>
  </div>
  <% if @ad %>
  <div class="field">
    <%= f.label :ad %>
    <%= f.text_field :ad, :value => @ad %>
  </div>
  <div class="field">
    <%= f.label :sum %>
    <%= f.text_field :sum, :value => @ad.cost %>
  </div>
  <% else %>
    <%= f.hidden_field :ad %>
    <div class="field">
      <%= f.label :sum %>
      <%= f.text_field :sum %>
    </div>
  <% end %>
  <div class="field">
    <%= f.label :description %>
    <%= f.text_area :description %>
  </div>
  <div class="actions">
    <%= f.submit "Valider la transaction" %>
  </div>
<% end %>
